package com.cf.util;

/**
 * @author: chenfeng
 * @time: 2019/6/18 11:12
 */
public class PurchaseResponse {

    private int status;
    private int total;
    private Object data;
    private String msg;
    private boolean isSuccess;

    public int getStatus() {
        return status;
    }

    public Object getData() {
        return data;
    }

    public String getMsg() {
        return msg;
    }

    public int getTotal() {
        return total;
    }

    public boolean isSuccess() {
        return isSuccess;
    }

    private PurchaseResponse(int status, int total, Object data, String msg, boolean isSuccess) {
        this.status = status;
        this.total = total;
        this.data = data;
        this.msg = msg;
        this.isSuccess = isSuccess;
    }

    public static PurchaseResponse success(int total, Object data, String msg) {
        return new PurchaseResponse(0, total, data, msg, true);
    }

    public static PurchaseResponse success(String msg) {
        return new PurchaseResponse(0, 0, null, msg, true);
    }

    public static PurchaseResponse failure(int total, Object data, String msg) {
        return new PurchaseResponse(1, total, data, msg, false);
    }

    public static PurchaseResponse failure(String msg) {
        return new PurchaseResponse(1, 0, null, msg, false);
    }


}
